﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Web;
using Team4Mock.DAO;
namespace Team4Mock.Entity
{
    
    public class ContactEntity
    {
        ContactDAO cd = new ContactDAO();
        private int contactID;

        private string firstName;
        private string suname;
        private string knowAs;
        private string officePhone;
        private string mobilePhone;
        private string sTHomePhone;
        private string email;
        private int managerID;
        private int contactType;
        private int bestContactMethod;
        private string jobRole;
        private string workbase;
        private string jobTitle;
        private int isActive;
        private int index;
        public ContactEntity()
        {
            //this.firstName = "";
            //this.suname = "";
            //this.knowAs = "";
            //this.officePhone = "";
            //this.mobilePhone = "";
            //this.sTHomePhone = "";
            //this.email = ""; ;
            //this.managerID = 0 ;
            //this.contactType = 0 ;
            //this.bestContactMethod = 0;
            //this.jobRole = "";
            //this.workbase = "";
            //this.jobTitle = "";
            //this.isActive = false;
        }
        public ContactEntity(string firstName, string suname, string knowAs, string officePhone, string mobilePhone, string sTHomePhone, string email, int managerID, int contactType, int bestContactMethod, string jobRole, string workbase, string jobTitle, int isActive)
        {
            this.firstName = firstName;
            this.suname = suname;
            this.knowAs = knowAs;
            this.officePhone = officePhone;
            this.mobilePhone = mobilePhone;
            this.sTHomePhone = sTHomePhone;
            this.email = email;
            this.managerID = managerID;
            this.contactType = contactType;
            this.bestContactMethod = bestContactMethod;
            this.jobRole = jobRole;
            this.workbase = workbase;
            this.jobTitle = jobTitle;
            this.isActive = isActive;
        }
        public int ContactID
        {
            get { return contactID; }
            set { contactID = value; }
        }
        public int Index
        {
            get { return index; }
            set { index = value; }
        }

        public string FirstName
        {
            get { return this.firstName; }
            set
            {
                if (value == null)
                    throw new Exception("firstName not allow nullvalue.");
                this.firstName = value;
            }
        }
        public string Suname
        {
            get { return this.suname; }
            set
            {
                if (value == null)
                    throw new Exception("suname not allow nullvalue.");
                this.suname = value;
            }
        }
        public string KnowAs
        {
            get { return this.knowAs; }
            set { this.knowAs = value; }
        }
        public string OfficePhone
        {
            get { return this.officePhone; }
            set { this.officePhone = value; }
        }
        public string MobilePhone
        {
            get { return this.mobilePhone; }
            set { this.mobilePhone = value; }
        }
        public string STHomePhone
        {
            get { return this.sTHomePhone; }
            set { this.sTHomePhone = value; }
        }
        public string Email
        {
            get { return this.email; }
            set { this.email = value; }
        }
        public int ManagerID
        {
            get { return this.managerID; }
            set { this.managerID = value; }
        }
        public int ContactType
        {
            get { return this.contactType; }
            set
            {
                this.contactType = value;
            }
        }
        public int BestContactMethod
        {
            get { return this.bestContactMethod; }
            set { this.bestContactMethod = value; }
        }
        public string JobRole
        {
            get { return this.jobRole; }
            set { this.jobRole = value; }
        }
        public string Workbase
        {
            get { return this.workbase; }
            set { this.workbase = value; }
        }
        public string JobTitle
        {
            get { return this.jobRole; }
            set { this.jobTitle = value; }
        }
        public int IsActive
        {
            get { return this.isActive; }
            set { this.isActive = value; }
        }
        public void InsertData(ContactEntity e)
        {
            cd.InsertData(e.FirstName, e.Suname, e.KnowAs, e.OfficePhone, e.MobilePhone, e.STHomePhone, e.Email, e.ManagerID, e.ContactType, e.BestContactMethod, e.JobRole, e.Workbase, e.JobTitle, e.IsActive);
        }
        public void UpdateData(ContactEntity e)
        {
            cd.UpdateData(e.ContactID,e.FirstName, e.Suname, e.KnowAs, e.OfficePhone, e.MobilePhone, e.STHomePhone, e.Email, e.ManagerID, e.ContactType, e.BestContactMethod, e.JobRole, e.Workbase, e.JobTitle, e.IsActive);
        }
        public DataTable GetData()
        {
            return cd.GetData();
        }
        public DataTable GetDataTrue()
        {
            return cd.GetDataTrue();
        }
        public DataTable GetContactType()
        {
            return cd.GetContactType();
        }
        public DataTable GetContactBestMethod()
        {
            return cd.GetContactBestMethod();
        }
        public DataTable GetbyID(ContactEntity e)
        {
            return cd.GetByID(e.ContactID);
        }
        public DataTable Search(ContactEntity e)
        {
            return cd.Search(e.Index, e.FirstName, e.Suname);
        }

    }
}